package com.ops.uitl.jdbc;

import com.ops.uitl.common.Common;
import com.ops.uitl.tapestry.BaseData;
import org.apache.log4j.Logger;

import java.util.Random;

public class BaseFactory {

	public static final String CENTER_CONNECTION_NAME = "sdcen1";
	public static final String JBPM_CONNECTION_NAME = "jbpm";
	public static final String LOCAL_HOST_ADDR = "127.0.0.1";

	public static final int DATABASE_TYPE_ORACLE = 1;
	public static final int DATABASE_TYPE_DB2 = 2;
	public static final int DATABASE_TYPE_SYBASE = 3;
	public static final int DATABASE_TYPE_SQLSERVER = 4;
	public static final int DATABASE_TYPE_MYSQL = 5;

	public static final String MULTICONN_TYPE_CONNNAME = "1";			//多连接：按连接名取
	public static final String MULTICONN_TYPE_EPARCHY = "2";			//多连接：按地州取

	public static final String CONNECTION_TYPE_CONNNAME = "connname";	//按连接名取
	public static final String CONNECTION_TYPE_DATABASE = "database";	//按分库取

	protected static Logger log = Logger.getLogger(BaseFactory.class);
	protected static Common common = Common.getInstance();

	/**
	 * get param table name
	 * @param bd
	 * @return String
	 * @throws Exception
	 */
	public static String getParamTableName(BaseData bd) throws Exception {
		return "TD_S_STATIC";
	}

	/**
	 * get uniqe name
	 * @return String
	 * @throws Exception
	 */
	public static String getUniqeName() throws Exception {
		return String.valueOf(System.currentTimeMillis()) + Math.abs(new Random().nextInt());
	}

}